exports.Scene = class Scene {
    constructor() {
        this.players = new Map;
    }

    addPlayer(player) {
        this.players.set(player.playerId, player);
    }

    removePlayer(playerId) {
        this.players.delete(playerId);
    }   

    changePlayer(playerId, state, position) {
        if (this.players.has(playerId)) {
            const player = this.players.get(playerId);
            player.state = state;
            player.x = position.x;
            player.y = position.y;
        }
    } 

    getPlayersNot(playerId) {
        const playerArray = [];
        for (let player of this.players.values()) {
            if (player.playerId !== playerId) {
                playerArray.push(player);
            }
        }
        return playerArray;
    }
}
